package com.baymax.test.scene.demo

import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.animation.addListener
import com.baymax.test.scene.BaseScene
import com.baymax.test.scene.addButton
import com.baymax.test.scene.installLogger
import com.baymax.test.scene.newSceneFlexContainer

class LNAnimatorScene : BaseScene() {
    override fun onCreateView(
        p0: LayoutInflater,
        p1: ViewGroup,
        p2: Bundle?
    ): View {
        return p1.newSceneFlexContainer {
            val logger = installLogger(this)
            addButton("test value animator ") {
                ValueAnimator.ofInt(0, 1000).apply {
                    duration = 1000
                    addListener(onStart = { logger("start") },
                        onEnd = { logger("end") })
                    String
                    addUpdateListener {
                        logger(it.animatedFraction.toString())
                    }
                    start()
                }
            }


        }
    }
}